﻿using rmTest.Common.ModelUtil;
using System;
using System.Collections.Generic;
using System.Text;

namespace rmTest.Common.AttrUtil
{
    public abstract class ModelBaseValidateAttribute : Attribute
    {
        public ModelBaseValidateAttribute() { }

        public ModelBaseValidateAttribute(bool ignored = false, bool required = false, bool isPrimaryKey = false)
        {
            this.Ignored = ignored;
            this.Required = required;
            this.IsPrimaryKey = isPrimaryKey;
        }
        /// <summary>
        /// 是否不存储到数据库
        /// </summary>
        public bool Ignored = false;
        /// <summary>
        /// 是否必填
        /// </summary>
        public bool Required = false;
        /// <summary>
        /// 是否主键
        /// </summary>
        public bool IsPrimaryKey = false;
        public abstract void Validate<T>(ModelBaseValidateAttribute attribute, T value, ValidateResult result);
    }
}
